package com.ace3l.legal.gwt.domainmodule.client;

import com.google.gwt.user.client.rpc.ServiceDefTarget;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.core.client.GWT;
import com.synesthesiaconsulting.gwt.resources.client.GWTUtils;

/**
 * Created by IntelliJ IDEA.
 * User: ageer
 * Date: Jul 31, 2008
 * Time: 2:15:23 AM
 * To change this template use File | Settings | File Templates.
 */
public interface AdminPortalService extends RemoteService {
    /**
     * Utility/Convenience class.
     * Use AdminPortalService.App.getInstance() to access static instance of AdminPortalServiceAsync
     */
    public static class App {
        private static AdminPortalServiceAsync ourInstance = null;

        public static synchronized AdminPortalServiceAsync getInstance() {
            if (ourInstance == null) {
                ourInstance = (AdminPortalServiceAsync) GWT.create(AdminPortalService.class);
                if (GWT.isScript()) {
                    ((ServiceDefTarget) ourInstance).setServiceEntryPoint(GWTUtils.getUrlWithContext() + "/gwt/AdminPortalService");
                } else {
                    ((ServiceDefTarget) ourInstance).setServiceEntryPoint(GWT.getModuleBaseURL() + "com.ace3l.legal.gwt.domainmodule.Ace3LDomainModule/AdminPortalService");
                }
            }
            return ourInstance;
        }
    }
}
